Internet Control Pack Controls Summary
Data Stream Objects
Internet Control Pack
Using the Internet ActiveX™ Controls
The Microsoft Internet Control Pack is a series of ActiveX™ Controls (formerly called OLE controls) that enable developers to easily create powerful Internet applications based on the current base Internet protocols. The Internet ActiveX Controls work with all of the Microsoft Visual Tools products - Microsoft Access, Visual Basic, Visual FoxPro, Visual C++.

This page provides you with everything you need to know to use the Internet ActiveX Controls. The links for each control jump to detailed topics covering all language elements and tutorial information.

 
Controls Summary
FTP ActiveX Control (client)
The File Transfer Protocol (FTP) is a widespread, standard network protocol used for the transfer of files over networks. The FTP Client control allows the Microsoft Access, Visual Basic, or Visual FoxPro developer to easily implement FTP into applications and take advantage of the large installed base of FTP servers.
HTML ActiveX Control (client)
The HTML Control provides parsing and layout of HTML data, as well as a scrollable view of the selected HTML page.
HTTP ActiveX Control (client)
The HTTP (Hypertext Transport Protocol) control implements the HTTP protocol client based on the HTTP specification.
NNTP ActiveX Control (client)
The NNTP Client control allows you to connect to a news server, retrieve a list of available newsgroups and their descriptions, enter a newsgroup, get lists of articles, and to get any article.

This control implements the basic client NNTP Protocol as specified by RFC977, Network News Transfer Protocol. THE NNTP control also implements NNTP extension commands as documented in the Internet-Draft on Common NNTP Extensions. For questions on Internet-Drafts contact, Internet-Drafts@CNRI.Reston.VA.US.

POP ActiveX Control (client)
The POP control provides access to Internet mail servers using the POP3 protocol. It can be used by Internet mail developers or system integrators. The major advantage of this control is its ability to retrieve mail from UNIX or other servers supporting the POP3 protocol.
SMTP ActiveX Control (client)
The SMTP Client control provides a reusable component that gives applications access to SMTP mail servers and mail posting capabilities.
WinSock TCP ActiveX Control (client and server)
The WinSock TCP control is a connection-based control, and is analogous to a telephone the user must establish a connection before proceeding.
WinSock UDP ActiveX Control (client and server)
The WinSock UDP control is a connectionless control and analogous to a radio. The computer sending data can just "broadcast" without establishing a connection, and the receiving computer need not respond.

Both the WinSock TCP and the WInSock UDP control allow data to be exchanged in both directions.

 
Data Stream Objects
The Internet Control Pack includes several controls which allow you to connect to external servers (the Internet) and download files. In some cases, the files may be large, and take a minute or longer to download. The data stream that returns from the Internet is aysnchronousùdata arrives in "packets," instead of a single stream. To handle the asynchronous data stream, the following OLE objects have been created:
  • DocHeader Object
  • DocInput Object
  • DocOutput Object
  • icErrors Object
Data streams: data, DocHeaders, and icErrors

The DocInput and DocOutput objects serve as routers of incoming and outgoing data streams. Whenever a control streams data, you can use the DocInput or DocOutput object to parse the data and assign the data stream to one of several destinations:

  • Dataùdata that can be passed to a container (such as a TextBox control) or a file
  • DocHeaders collectionùHeader information that varies from control to control. For example, a collection of NNTP DocHeader objects would contain subject, destination, and newsgroup
  • icErrors collectionùif an error occurs on the netword that is sending the data, information about the error can be stored in an icError object
Scenario: Using the DocInput object to retrieve an NNTP document

A common task is to download messages from a remote news server. The steps to downloading a message using the DocOutput object are as follows:

  1. The NNTP control invokes a GetArticleByArticleNumber method.
  2. The remote server responds by sending the article in data packets.
  3. On the client computer, the DocInput event is triggered as each data packet arrives.
  4. The DocInput passes a reference to aDocInput object.
  5. The DocInput object includes a State property which indicates the state of the data stream.
  6. Depending on the value of the State property, incoming data is passed either into a data variable, an icError object, or a DocHeader object.
  7. Presuming no errors have occurred, use the GetData method of the DocObject to pass the data into a container or a file.
The following code shows this process:

Private SubGetArticleByNumber_Click()
	' Presuming an NNTP control exists by the name of
	' of "nntp1".
	' txtArticleNum is a TextBox control containign the 
	' required parameter.
	nntp1.GetArticleByArticleNumber txtArticleNum
End Sub

Private nntp1_DocInput(DocInput As DocInput)
	Dim vtData     ' Variable for data.
	Select Case DocInput.State
	Case icDocNone ' No transfer in progress.
		Exit Sub  
      Case icDocBegin ' Transer is being initiated.
            ' Open a file for input

	Case icDocHeaders ' Document headers are being 
				' transferred.
		' Add the Header to the DocHeaders collection.
	Case icDocData	' One block of data is 
				' transferred.
		' Use the Getdata Method to retrieve the data
		DocInput.GetData vtData
	Case icError
		' If it's an error, use the icErrors collection.
		MsgBox icErrors.Description
	End Case
End Sub
		

The previous code demonstrates the basics of getting data from a control that uses the DocInput or DocOutput objects. In simple terms, the DocOutput is used to stream data out the machine, and the DocInput object is used to process incoming data.


© 1996 by Microsoft Corporation.